<?php
$this->Html->scriptBlock($scriptSearchBox, array('inline' => false));
?>
<div class="title-body-content"><?php echo $title_for_layout; ?></div>
<div class="searchbox" style="margin-top: 15px;">
    From &nbsp;<input type="text" id="match_from_id" readonly="readonly" value="<?php echo date('m/d/Y');?>" class="sel-date" name="match_from" />
    &nbsp;&nbsp;To &nbsp;<input type="text" id="match_to_id" readonly="readonly" value="<?php echo date('m/d/Y', strtotime(date('Y-m-d H:i:s'))+7*24*60*60);?>" class="sel-date" name="match_to" />
    <input type="button" id="search_button" value="Search" class="searchbutton" />
</div>
<div class="wrapper-table clearfix">
    <table class="tbl-broking" border="1">
        <tr class="title-tbl" >
            <td class="td-bank-acc" style="width:120px;"><?php echo __('Date'); ?></td>
            <td class="td-bank-address" style="width:90%;"><?php echo __('Reminder'); ?></td>
        </tr>
        <?php
        foreach ($arr AS $key => $value) {
            echo '
                <tr class="line-content-tbl" >
                    <td class="td-bank-acc" style="text-align:center; width:120px;">' . date('m/d/Y', strtotime($key)) . '</td>
                    <td class="td-bank-address" style="text-align:left; padding-left:4px; width:90%;">';
            foreach($value as $reminder) {
                $actions = $this->Html->link($reminder['summary'], array(
                            'controller' => 'reminders',
                            'action' => 'view',
                            $reminder['id'],
                        ), array('rel' => 'reminder'));
                echo $actions . '<br />';
            }
            echo '
                    </td>
                </tr>';
        }
        ?>
    </table>
</div>
<?php
$datePicker = "
    $(function() {
        var childWin;
        $('a[rel=\"reminder\"]').click( function() {
            childWin = window.open($(this).attr('href'), 'child', 'modal,width=440,height=280,scrollbars=yes');
            return false;
        });
        
        $('#match_from_id').datepicker({ changeYear: true, dateFormat: 'm/d/yy'});
        $('#match_to_id').datepicker({ changeYear: true, dateFormat: 'm/d/yy'});
        return false;
    });";

$this->Html->scriptBlock($datePicker, array('inline' => false));
?>